package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum GoodsHistoryType {
	
	EXPOSURE(0,"曝光"),
	VIEW(1,"浏览"),
	SHARE(2,"分享"),
	VISIT(3,"分享(访问)");
	
	private Integer value;
	
	private String text;

	private GoodsHistoryType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static GoodsHistoryType toType(int value) {
		if (EXPOSURE.value == value) {
			return EXPOSURE;
		} else if(VIEW.value == value){
			return VIEW;
		} else if(SHARE.value == value){
			return SHARE;
		} else if(VISIT.value == value){
			return VISIT;
		} else {
			throw new InvalidArgumentException("Unknown PayHistoryType[" + value + "].");
		}
	}
}
